package com.zoffy.ybuhelper.pojo.entity;

import androidx.annotation.NonNull;
import androidx.room.ColumnInfo;
import androidx.room.Entity;
import androidx.room.ForeignKey;
import androidx.room.Index;

@Entity(tableName = "menu_category",
        primaryKeys = {"menu_id","category_id"},

        indices = {@Index("menu_id"),@Index("category_id")},
        foreignKeys = {@ForeignKey(
                entity = Menu.class,
                parentColumns = "id",
                childColumns = "menu_id",
                onDelete = ForeignKey.CASCADE
        ),
                @ForeignKey(
                        entity = Category.class,
                        parentColumns = "id",
                        childColumns = "category_id",
                        onDelete = ForeignKey.CASCADE
                )
        })
public class MenuCategory {
    @ColumnInfo(name="menu_id",typeAffinity = ColumnInfo.INTEGER)
    @NonNull
    private Integer menuId;
    @NonNull
    @ColumnInfo(name="category_id",typeAffinity = ColumnInfo.INTEGER)
    private Integer categoryId;

    public Integer getMenuId() {
        return menuId;
    }

    public void setMenuId(Integer menuId) {
        this.menuId = menuId;
    }

    public Integer getCategoryId() {
        return categoryId;
    }

    public void setCategoryId(Integer categoryId) {
        this.categoryId = categoryId;
    }
    public MenuCategory(Integer menuId,Integer categoryId){
        this.menuId=menuId;
        this.categoryId=categoryId;
    }
}
